package com.xsmart.order.api;

import com.xsmart.common.entity.RequestBean;
import com.xsmart.common.entity.ResponseBean;
import com.xsmart.order.services.RecObjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * @author DIYC
 */
@Controller
@RequestMapping("/api")
public class RecObjectController {
    @Autowired
    RecObjectService service;

    /**
     * 查询
     * @param requestBean
     * @param request
     * @return
     */
    @RequestMapping(value = "/v1/RecObjectService/queryRecObject", method = RequestMethod.POST)
    @ResponseBody
    public ResponseBean queryRecObject(@ModelAttribute RequestBean requestBean, HttpServletRequest request){
        return service.queryRecObject(requestBean);
    }

    /**
     * 新增推荐对象
     * @param requestBean
     * @param request
     * @return
     */
    @RequestMapping(value = "/v1/RecObjectService/addRecObject", method = RequestMethod.POST)
    @ResponseBody
    public ResponseBean addShipping(@ModelAttribute RequestBean requestBean, HttpServletRequest request) {
        return service.addRecObject(requestBean);
    }

    /**
     * 修改
     * @param requestBean
     * @param request
     * @return
     */
    @RequestMapping(value = "/v1/RecObjectService/modRecObject", method = RequestMethod.POST)
    @ResponseBody
    public ResponseBean modRecObject(@ModelAttribute RequestBean requestBean, HttpServletRequest request){
        return service.modRecObject(requestBean);
    }

    /**
     * 删除推荐对象
     * @param requestBean
     * @param request
     * @return
     */
    @RequestMapping(value = "/v1/RecObjectService/delRecObject", method = RequestMethod.POST)
    @ResponseBody
    public ResponseBean delRecObject(@ModelAttribute RequestBean requestBean, HttpServletRequest request){
        return service.delRecObject(requestBean);
    }

}
